﻿<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <style type="text/css">
        h1
        {
            font-family: MyriadPro-Semibold, 'Myriad Pro Semibold' , 'Myriad Pro' , 'Trebuchet MS' , Tahoma, arial, sans-serif;
            font-size: 250%;
            margin: 0px;
            padding: 0px;
            margin-bottom: 20px;
            text-shadow: #ccc 1px 1px 0;
        }
        .icon-delete
        {
            background-image: url(/icons/delete-png/coolite.axd) !important;
        }
    </style>
    <script type="text/javascript">
        var commandHandler = function (cmd, record) {
            switch (cmd) {
                case "delete":
                    Ext.Msg.confirm('Alert', '是否确认删除?', function (btn) {
                        if (btn == "yes") {
                            dsMessage.remove(record);
                        }
                    });
                    break;
            }
        }
    </script>
</head>
<body>
    <ext:ResourceManager runat="server" />
    <ext:Store ID="dsMessage" runat="server" RemoteSort="true">
        <Proxy>
            <ext:HttpProxy Url="/Admin/GetMessages.html" />
        </Proxy>
        <UpdateProxy>
            <ext:HttpWriteProxy Url="/Admin/SaveMessages.html" />
        </UpdateProxy>
        <Reader>
            <ext:JsonReader IDProperty="ID" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="ID" />
                    <ext:RecordField Name="Content" />
                    <ext:RecordField Name="MessageDate" />
                    <ext:RecordField Name="UserName" />
                    <ext:RecordField Name="UserPhone" />
                    <ext:RecordField Name="UserQQ" />
                    <ext:RecordField Name="UserEmail" />
                    <ext:RecordField Name="Reply" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="limit" Value="15" Mode="Raw" />
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="dir" Value="ASC" />
            <ext:Parameter Name="sort" Value="ID" />
        </BaseParams>
    </ext:Store>
    <ext:Viewport ID="ViewPort1" runat="server">
        <Items>
            <ext:RowLayout ID="RowLayout1" runat="server">
                <Rows>
                    <ext:LayoutRow RowHeight="0.2">
                        <ext:Panel ID="Panel1" runat="server">
                            <Content>
                                <div style="margin-left: 20px; margin-top: 20px">
                                    <h1>
                                        用户留言管理</h1>
                                    <br />
                                </div>
                            </Content>
                        </ext:Panel>
                    </ext:LayoutRow>
                    <ext:LayoutRow RowHeight="0.8">
                        <ext:GridPanel ID="GridPanel1" AutoHeight="false" runat="server" Header="false" Border="false"
                            ClicksToEdit="1" StoreID="dsMessage" AutoExpandColumn="Content" TrackMouseOver="true">
                            <columnmodel id="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column Sortable="false" ColumnID="ID" DataIndex="ID" Header="ID">
                                </ext:Column>

                                <ext:Column Sortable="false" ColumnID="UserName"  DataIndex="UserName" Header="用户">
                                </ext:Column>
                                <ext:Column Sortable="false" ColumnID="UserPhone"  DataIndex="UserPhone" Header="用户电话">
                                </ext:Column>
                                <ext:Column Sortable="false" ColumnID="UserQQ"  DataIndex="UserQQ" Header="用户QQ">
                                </ext:Column>
                                <ext:Column Sortable="false" ColumnID="UserEmail"  DataIndex="UserEmail" Header="用户邮箱">
                                </ext:Column>
                                <ext:Column Sortable="false" ColumnID="Content"  Wrap="true" DataIndex="Content" Header="留言内容">
                                 
                                </ext:Column>
                                <ext:Column Sortable="false" Width="150" ColumnID="MessageDate"  DataIndex="MessageDate" Header="留言时间">
                                    <Renderer Format="Date" FormatArgs="'Y-m-d G:i:s'" />
                                </ext:Column>
                                 <ext:Column Sortable="false" Width="150" ColumnID="Reply"  DataIndex="Reply" Header="快速回复">
                                    <Editor>
                                        <ext:TextArea runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:CommandColumn Width="25">
                                    <Commands>
                                        <ext:GridCommand CommandName="delete" Icon="delete">
                                            <ToolTip Text="删除" />
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                            </Columns>
                        </columnmodel>
                            <SelectionModel>
                                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                                </ext:RowSelectionModel>
                            </SelectionModel>
                            <bottombar>
                            <ext:PagingToolbar ID="PagingToolbar1" runat="server" StoreID="dsMessage" PageSize="15" />
                        </bottombar>
                        <TopBar>
                                <ext:Toolbar ID="Toolbar1" runat="server">
                                    <Items>
                                        <ext:Button ID="Button2" runat="server" Text="保存" Icon="Disk">
                                            <Listeners>
                                                <Click Handler="#{GridPanel1}.save();" />
                                            </Listeners>
                                        </ext:Button>
                                    </Items>
                                </ext:Toolbar>
                            </TopBar>
                            <Listeners>
                                <command fn="commandHandler" />
                            </Listeners>
                            <loadmask showmask="true" Msg="加载中..." />
                            <savemask showmask="true" Msg="保存中..." />
                        </ext:GridPanel>
                    </ext:LayoutRow>
                </Rows>
            </ext:RowLayout>
        </Items>
    </ext:Viewport>
</body>
</html>
